<template>
	<view class="flex-col page">
		<view class="flex-col group">
			<view class="flex-col" v-if="list.length>0">
				<view class="flex-col section_1" v-for="(item,index) in list " :key="index">
					<view class="flex-col">
						<view class="justify-between group_3">
							<view class="flex-row items-center">
								<image
									src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/617a2ca7e4f1450011362b37/62b14c62d02982001153329a/16557868164040773153.png"
									class="image_1" />
								<text class="text_1">我的家{{index>0?index+1:''}}</text>
								<image @click="go('/pages/index/editHourse?id='+item.projectId)"
									src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/617a2ca7e4f1450011362b37/62b14c62d02982001153329a/16557867932504125179.png"
									class="image_3 image_4" />
							</view>
							<text class="text_2" @click="go('/pages/index/editHourse?id='+item.projectId)">进入管理</text>
						</view>

					</view>
					<view class="flex-col group_6" @click="setDefault(item.projectId)">
						<view class="justify-between ">
							<text class="text_3">你的房屋位置</text>
							<text class="text_5">{{item.provinceName}} {{item.cityName}} {{item.districtName}}</text>
						</view>
						<view class="justify-between group_8">
							<text class="text_7">你的房屋面积</text>
							<text class="text_9">{{item.roomArea}}m²</text>
						</view>
						<view class="justify-between group_8">
							<text class="text_11">房屋类型</text>
							<text class="text_13">{{item.roomTypeName}}</text>
						</view>
					</view>
				</view>

			</view>
			<view v-else>
				<u-empty mode="data" width="250" marginTop="60%" textSize="30rpx"
					icon="http://cdn.uviewui.com/uview/empty/data.png">
				</u-empty>
			</view>
			<view class="flex-col items-center button" @click="go('/pages/index/editHourse')"><text
					class="text_23">+新增我的家</text></view>
		</view>
	</view>
</template>

<script>
	export default {
		components: {},
		data() {
			return {
				list: []
			};
		},
		created() {
			this.getFamilies()

		},
		methods: {
			getFamilies() {
				this.$http('lhouse.list').then(r => {
					this.list = r.data;
				});
			},
			setDefault(id) {
				this.$http('lhouse.setDefault', {
					projectId: id
				}).then(r => {
					if (r.code == 200) {
						uni.showToast({
							title: '切换成功',
							duration: 2000,
							success: () => {
								this.go('/pages/index/my', true);
							}
						});
					}
				});
			}
		},
	};
</script>

<style scoped lang="scss">
	.group_6 {
		margin-top: 39rpx;
		padding-left: 9rpx;
		padding-right: 7rpx;
	}

	.group_5 {
		padding: 22rpx 7rpx 0 9rpx;
	}

	.image_1 {
		flex-shrink: 0;
		width: 30rpx;
		height: 28rpx;
	}

	.image_3 {
		flex-shrink: 0;
		width: 30rpx;
		height: 32rpx;
	}

	.text_3 {
		color: #333333;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';
		line-height: 33rpx;
	}

	.text_5 {
		color: #333333;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';
		line-height: 33rpx;
	}

	.text_11 {
		color: #333333;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';
		line-height: 33rpx;
	}

	.text_13 {
		color: #333333;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';
		line-height: 33rpx;
	}

	.group_8 {
		margin-top: 33rpx;
	}

	.text_7 {
		margin-bottom: 6rpx;
		color: #333333;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';
		line-height: 33rpx;
	}

	.text_9 {
		margin-top: 6rpx;
		color: #333333;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';
		line-height: 33rpx;
	}

	.page {
		background-color: #f6f7f9ff;
		width: 100%;
		overflow-y: auto;
		overflow-x: hidden;
		height: 100vh;

	}

	.group {
		padding: 20rpx 24rpx 48rpx;
		flex: 1 1 auto;
		overflow-y: auto;
	}

	.button {
		position: fixed;
		bottom: 30rpx;
		left: 20rpx;
		right: 20rpx;
		padding: 19rpx 31rpx;
		background-color: #1d6aff;
		border-radius: 44rpx;
	}

	.section_1 {
		padding: 29rpx 15rpx 41rpx;
		background-color: #ffffff;
		border-radius: 16rpx;
		margin-bottom: 30rpx;
	}

	.section_2 {
		margin-top: 20rpx;
		padding: 33rpx 15rpx 41rpx;
		background-color: #ffffff;
		border-radius: 16rpx;
	}

	.text_23 {
		color: #ffffff;
		font-size: 32rpx;
		font-family: '.AppleSystemUIFont';

	}

	.group_3 {
		padding: 0 8rpx 38rpx 9rpx;
		border-bottom: solid 1rpx #eeeeee;
	}

	.group_10 {
		padding: 0 8rpx 35rpx 9rpx;
		border-bottom: solid 1rpx #eeeeee;
	}

	.text_2 {
		margin: 4rpx 0 5rpx;
		color: #1d6aff;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';
		line-height: 33rpx;
	}

	.group_11 {
		margin-top: 3rpx;
	}

	.text_16 {
		margin-bottom: 8rpx;
		color: #1d6aff;
		font-size: 28rpx;
		font-family: '.AppleSystemUIFont';
		line-height: 33rpx;
	}

	.text_1 {
		margin-left: 8rpx;

		color: #1d6aff;
		font-size: 32rpx;
		font-family: '.AppleSystemUIFont';

	}

	.image_4 {
		margin-left: 17rpx;

	}

	.image_5 {
		margin: 5rpx 0;
	}

	.text_15 {
		margin-left: 8rpx;
		color: #1d6aff;
		font-size: 32rpx;
		font-family: '.AppleSystemUIFont';
		line-height: 38rpx;
	}

	.image_6 {
		margin: 3rpx 0 3rpx 16rpx;
	}
</style>
